package com.demo.function;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

public class Demo {
    public static void main(String[] args) {
//        Function function = (str) -> {return str+"----adc";};
        Function function = str ->  str+"----adc";
        System.out.println(function.apply("hello"));

        /*Predicate<String> predicate = new Predicate<String>(){
            @Override
            public boolean test(String str) {
                return str.isEmpty();
            }
        };*/
        Predicate<String> predicate = str -> str.isEmpty();
        System.out.println(predicate.test(""));


        /*Consumer<String> consumer = new Consumer<String>() {
            @Override
            public void accept(String str) {
                System.out.println("str = " + str);
            }
        };*/
        Consumer<String> consumer = str -> System.out.println("str = " + str);
        consumer.accept("number");

        /*Supplier supplier = new Supplier<Integer>() {
            @Override
            public Integer get() {
                return 1024;
            }
        };*/
        Supplier supplier = ()->{return 1024;};
        System.out.println(supplier.get());
    }
}
